home *** CD-ROM | disk | FTP | other *** search
- package sub_arctic.lib;
-
- import sub_arctic.output.loaded_image;
- import sub_arctic.output.drawable;
- import java.awt.Image;
-
- /**
- * This object simply displays a horizontal or vertical line (suitable for
- * use as a separator) on the screen. It has no input behavior.<p>
- *
- * @author Scott Hudson
- */
- public class hv_line extends base_interactor {
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * Full constructor.
- * @param int x the x coordinate of the line
- * @param int y the y coordinate of the line
- * @param boolean is_horz whether this line is horizontal or vertical.
- * @param int len length of the line
- */
- public hv_line(int x, int y, boolean is_horz, int len)
- {
- super(x,y, is_horz?len:1, is_horz?1:len);
-
- _is_horiz = is_horz;
- }
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * Simple constructor assuming a 0,0 position.
- *
- * @param boolean is_horz whether this line is horizontal or vertical.
- * @param int len length of the line
- */
- public hv_line(boolean is_horz, int len)
- {
- this(0,0, is_horz, len);
- }
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * Simple constructor assuming a 0,0 position and default (temp) length.
- *
- * @param boolean is_horz whether this line is horizontal or vertical.
- */
- public hv_line(boolean is_horz)
- {
- this(0,0, is_horz, 17);
- }
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /** Whether the line is horizontal or vertical. */
- protected boolean _is_horiz;
-
- /**
- * Whether the line is horizontal or vertical.
- * @return boolean true if the line is horizontal, false if its vertical.
- */
- public boolean is_horiz() {return _is_horiz;}
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * Draw the line.
- * @param drawable d the drawable to render this object on
- */
- protected void draw_self_local(drawable d)
- {
- d.drawLine(0,0,w()-1,h()-1);
- }
-
- //had:
- //* @exception general PROPAGATED
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * Indicate that we intrinsically constrain either height or width depending
- * on our orientation.
- * @return int bitset indicating intrinsically constrained dimension.
- */
- public int intrinsic_constraints() {
- if (is_horiz())
- return H;
- else
- return W;
- }
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
- }
- /*=========================== COPYRIGHT NOTICE ===========================
-
- This file is part of the subArctic user interface toolkit.
-
- Copyright (c) 1996 Scott Hudson and Ian Smith
- All rights reserved.
-
- The subArctic system is freely available for most uses under the terms
- and conditions described in
- http://www.cc.gatech.edu/gvu/ui/sub_arctic/sub_arctic/doc/usage.html
- and appearing in full in the lib/interactor.java source file.
-
- The current release and additional information about this software can be
- found starting at: http://www.cc.gatech.edu/gvu/ui/sub_arctic/
-
- ========================================================================*/
-